package com.teamone.etl.enterprise.request;

import com.teamone.etl.enterprise.entity.Enterprise;
import com.teamone.etl.util.NameUtil;
import java.math.BigDecimal;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 @author WangZhuoRan */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EnterpriseRequest extends Enterprise {
    /**
     页数
     */
    private Integer pageNum = 1;
    /**
     每页显示数
     */
    private Integer pageSize = 10;
    /**
     标记
     */
    private Integer flag;
    /**
     旧密码
     */
    private String oldPassword1;
    /**
     确认旧密码
     */
    private String oldPassword2;
    /**
     新密码
     */
    private String newPassword;

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum==null?1:pageNum;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize==null?10:pageSize;
    }

    public void init(){
        super.setAccessKey(NameUtil.getRandom(16, NameUtil.TYPE.LETTER_CAPITAL_NUMBER));
        super.setBalance(new BigDecimal(0));
        super.setSpent(new BigDecimal(0));
        super.setUpdateTime(new Date());
        super.setCreateTime(new Date());
    }

}